package com.cqw.commontest.utils;

import org.apache.commons.io.FileUtils;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-09-13 17:02
 * @Description: apache FileUtils
 */
public class FileUtilsTest {


    public static void main(String[] args) {
        //将文件的字节大小转换成我们显示的字符串，比如1024转换后1kb
        String size = FileUtils.byteCountToDisplaySize(1024);
        System.out.println(size); // 1KB

        //获取系统的临时目录路径
        String tempDirectoryPath = FileUtils.getTempDirectoryPath();
        System.out.println(tempDirectoryPath);  //C:\Users\CAOQIN~1\AppData\Local\Temp\

        //获取用户的主目录
        String userDirectoryPath = FileUtils.getUserDirectoryPath();
        System.out.println(userDirectoryPath);  //C:\Users\caoqingwen




    }


}
